# Maintainer : Christoph Reiter <reiter.christoph@gmail.com>

pkgname=namcap
pkgver=3.2.10
pkgrel=1
pkgdesc="A Pacman package analyzer"
arch=('any')
url="https://projects.archlinux.org/namcap.git/"
license=('GPL')
depends=('python'
         'python-pyalpm'
         'binutils')
makedepends=('python-setuptools')
source=(https://sources.archlinux.org/other/${pkgname}/${pkgname}-${pkgver}.tar.gz
        '001-disable-some-things.patch'
        '002-force-msys-python.patch'
        '003-handle-no-source.patch'
        'namcap.sh')
sha256sums=('d40479dd533e1171987579c5e11a09d55628addaf891256389839e1701117e06'
            'b3251592be11fcc7a667531c2b84bc1bbce25e29c7546d54b99a509b336dc429'
            'e45456455412eee2838069cfb0079925dddc997e0cc887f66899c72ac1d93aad'
            '8795bdf9e2ce0faad29be5a281d46f365d2ac1e19535874ec8899ddc2b3a6e7c'
            '875e4ddd70ad8f2cc26cdf9512f18872a76e8f5496e347b3a2701fc4f3fec0aa')
noextract=(${pkgname}-${pkgver}.tar.gz)

prepare() {
  tar -xzvf ${pkgname}-${pkgver}.tar.gz || true
  cp namcap.sh "${pkgname}-${pkgver}"
  cd ${pkgname}-${pkgver}

  patch -Nbp1 -i "${srcdir}/001-disable-some-things.patch"
  patch -Nbp1 -i "${srcdir}/002-force-msys-python.patch"
  patch -Nbp1 -i "${srcdir}/003-handle-no-source.patch"
}

build() {
  cd ${pkgname}-${pkgver}

  /usr/bin/python setup.py build
}

package() {
  cd ${pkgname}-${pkgver}

  /usr/bin/python setup.py install --prefix=/usr --root="${pkgdir}"

  mv "${pkgdir}/usr/bin/namcap.sh" "${pkgdir}/usr/bin/namcap"
}

